package org.vectrics.recruiter.struts.tag;

import org.vectrics.SystemException;
import org.vectrics.recruiter.user.RecruitPersonSearchCriteria;
import org.vectrics.security.Activity;
import org.vectrics.user.PersonSearchCriteria;

/**
 * @author pgoette
 * Clase encargada de mostrar los datos del candidato
 */
public class CandidateSearchResultsTag extends UserSearchResultsTag {
	
	private static final long serialVersionUID = 3598379751212177502L;

	/**
	 * Devuelve los criterios de los datos de la tabla.
	 */
	protected PersonSearchCriteria getUserCriteria() {
		// Si la request es nula tira una exepcion
		if (this.getRequest() == null)
			throw new SystemException("Http request not assigned to this instance");
		
		RecruitPersonSearchCriteria criteria = null;
		//Seteo el criterio
		criteria = (RecruitPersonSearchCriteria)this.getRequest().getSessionAttribute("userSelectCriteria");
		if (criteria == null) {
			criteria = new RecruitPersonSearchCriteria(super.getUserCriteria());
		}
		// muestro la ciudad y no muestro los empleados
		this.setShowHomeCity(true);
		criteria.setNotEmployees(true);

		return(criteria);
	}
	
	public CandidateSearchResultsTag() {
		super();
		this.setActivity(Activity.MANAGE_CANDIDATE);
	}
	

	protected String getPageListLink() {
		String link = null;
		link = getContextPath() + "/admin/candidate/index.do";
		return(link);
	}

}
